package com.application.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;

import com.application.appenum.ESB_TYPE;
import com.application.common.BaseLogger;
import com.application.config.BaseConfig;


@Service("com.application.core.EsbAssist")
public class EsbAssist {
	@Autowired
	@Qualifier("threadPoolTaskExecutor")
	private ThreadPoolTaskExecutor threadPoolTaskExecutor;

	
	public ThreadPoolTaskExecutor getThreadPoolTaskExecutor() {
		return threadPoolTaskExecutor;
	}


	public void setThreadPoolTaskExecutor(ThreadPoolTaskExecutor threadPoolTaskExecutor) {
		this.threadPoolTaskExecutor = threadPoolTaskExecutor;
	}


	public void doStart(){
		BaseLogger.writeDebugLog("doStart");
		BaseLogger.writeLog("I", "\n\n\n");
		if(ESB_TYPE.SERVER.getValue().equals(BaseConfig.getInstance().getEsbType())){
			BaseLogger.writeLog("I", "启动ESB服务器....");
		}else{
			BaseLogger.writeLog("I", "启动子系统服务....  系统编号:" + BaseConfig.getInstance().getSysCode());
			//BaseConfig.getInstance().setTaskThread(threadPoolTaskExecutor);
			//BaseConfig.getInstance().bindServiceId();
			BaseConfig.getInstance().runAllServer();
			
		}
	}
	
	
}
